//
//  ServiceApi.m
//  PayDemoIOS
//
//  Created by 杨红军 on 17/12/12.
//  Copyright © 2017年 zpon. All rights reserved.
//

#import "ServiceApi.h"

#import "HttpUtil.h"

#define BASEDOMAIN @"http://paydemo.17f.cn"

static ServiceApi *instance;

@implementation ServiceApi

+ (ServiceApi*)sharedServiceApi{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
         instance= [[self alloc] init];
    });
    return instance;
}

/*
 * 获取订单数据
 */
- (void)fetchOrderInfoWithparams:(NSDictionary *)params callback:(void (^)(NSDictionary * ))callback{
    NSString *url = [NSString stringWithFormat:@"%@/api/pay",BASEDOMAIN];
    [HttpUtil post:url params:params successCallback:^(NSDictionary *dic) {
        if (callback!=nil) {
            callback(dic);
        }
    } failCallback:^(NSError *error) {
        NSLog(@"请求出错:%@",error);
        if (callback!=nil) {
            callback(nil);
        }
    }];
}

@end
